package com.hxzy.system.feign;


import com.hxzy.common.vo.R;
import com.hxzy.system.dto.AdminLoginDTO;
import com.hxzy.system.entity.SysDictData;
import com.hxzy.system.entity.SysOperLog;
import com.hxzy.system.vo.SysUserVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.validation.Valid;
import java.util.List;
import java.util.Set;

/**
 * feign调用系统服务
 */
@FeignClient(value ="SYSTEMAPP",fallbackFactory =SystemServiceFeignClientFallbackFactory.class )
public interface SystemServiceFeignClient {

     /**
      * 获取所有的sys_dict_data的数据
      * @return
      */
     @GetMapping(value = "/dictdata/findAll")
     R<List<SysDictData>> findAllDictData();

     /**
      * 根据字典类型查询(从数据库中查询)
      * @param dictType
      * @return
      */
     @GetMapping(value = "/dictdata/type/{dictType}")
     R<List<SysDictData>>  findByDictTypeByDataBase(@PathVariable(value = "dictType") String dictType);

     /**
      * 根据字典类型查询(从redis中查询)
      * @param dictType
      * @return
      */
     @GetMapping(value = "/dictdata/cache/type/{dictType}")
     R<List<SysDictData>>  findByDictTypeByRedis(@PathVariable(value = "dictType") String dictType);

     /**
      * 新增日志
      * @param sysOperLog
      * @return
      */
     @PostMapping(value = "/log")
     R addLog(@RequestBody  SysOperLog sysOperLog);


     /**
      * 根据用户名查询信息
      * @param username
      * @return
      */
     @GetMapping(value = "/user/byname/{username}")
     R<SysUserVO> findUserByName(@PathVariable(value = "username") String username);

     /**
      * 根据用户ID获取菜单权限信息
      * @param userId
      * @return
      */
     @GetMapping(value = "/menu/ownperm/{userId}")
     R<Set<String>> findUserOwnPerm(@PathVariable(value = "userId") Long userId);


     /**
      * 登录
      * @param adminLoginDTO
      * @return
      */
     @PostMapping(value = "/login")
     R  authentication(@RequestBody @Valid AdminLoginDTO adminLoginDTO);

     /**
      * 获取当前登录用户的信息
      * @return
      */
     @GetMapping(value = "/user/info")
     R userInfo();


     /**
      * 获取当前用户的动态路由信息
      * @return
      */
     @GetMapping("/getRouters")
     R getRouters() ;




}
